﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Diagnostics;
using System.Web.UI;

namespace Lilium.Web.Mvc.Configuration
{
	public class OutputCacheConfigurationElement: ConfigurationElement
	{
		#region public int Duration

		private const string DurationPropertyName = "duration";

		[ConfigurationPropertyAttribute(DurationPropertyName)]
		public int Duration { [DebuggerNonUserCodeAttribute] get { return (int)base[DurationPropertyName]; } [DebuggerNonUserCodeAttribute] set { base[DurationPropertyName] = value; Inherited = false; } }

		#endregion

		#region public OutputCacheLocation Location

		private const string LocationPropertyName = "location";

		[ConfigurationPropertyAttribute(LocationPropertyName)]
		public OutputCacheLocation Location { [DebuggerNonUserCodeAttribute] get { return (OutputCacheLocation)base[LocationPropertyName]; } [DebuggerNonUserCodeAttribute] set { base[LocationPropertyName] = value; Inherited = false; } }

		#endregion

		public OutputCachePolicy GetCachePolicy()
		{
			return new OutputCachePolicy(Location, Duration);
		}

		internal bool Inherited
		{
			get;
			set;
		}
	}
}